/**
 * Created by yu on 16/9/3.
 * node中的事件
 * 核心模块events
 * 让自定义的类去继承events,从而具有操作事件的能力
 */
var EventEmitter = require('events');
var util = require('util');

function Girl(name){
    this.name = name;
    EventEmitter.call(this);
}
util.inherits(Girl,EventEmitter);
var girl = new Girl();
//添加事件监听
girl.on('look',function(){
    console.log('look');
})
//触发事件
girl.emit('look');



